import { onMounted, onUnmounted, ref } from 'vue';

export function usemouse() {
    const x = ref(0);
    const y = ref(0);

    function update(event) {
        x.value = event.pageX
        y.value = event.pageY
    }
    onMounted(() => {
        window.onmousemove = update
    })

    onUnmounted(() => {
        window.onmousemove = null
    })


    return { x, y }

}